﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MapEngine
{
    static public class AuxFunctions
    {
        //Función auxiliar para restringir valores a un rango
        public static T clamp<T>(T value, T min, T max) where T : System.IComparable<T>
        {
            T result = value;
            if (value.CompareTo(max) > 0) result = max;
            if (value.CompareTo(min) < 0) result = min;
            return result;
        }
    }


    public struct Range2D
    {
        public int firstX, firstY;
        public int lastX, lastY;
    }
}
